<template>
  <div class="user">
    <el-table :data="users" border style="width: 100%">
      <el-table-column
        fixed
        prop="uid"
        label="ID"
        width="100"
      ></el-table-column>
      <el-table-column prop="name" label="用户名" width="100"></el-table-column>
      <el-table-column
        prop="alisName"
        label="姓名"
        width="120"
      ></el-table-column>
      <el-table-column prop="sex" label="性别" width="100"></el-table-column>
      <el-table-column prop="deptId" label="部门" width="120"></el-table-column>
      <el-table-column
        prop="createTime"
        label="入职时间"
        width="120"
      ></el-table-column>
      <el-table-column prop="phone" label="手机" width="120"></el-table-column>
      <el-table-column prop="email" label="邮箱" width="160"></el-table-column>
      <el-table-column prop="status" label="状态" width="100"></el-table-column>
      <el-table-column fixed="right" label="操作" width="100">
        <template>
          <el-button type="text" size="small">查看</el-button>
          <el-button type="text" size="small">编辑</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      :page-size="5"
      
      layout="prev, pager, next"
      :total="total"
      @current-change="page"
    >
    </el-pagination>
  </div>
</template>

<script>
import axios from "axios";

export default {
  name: "User",
  methods: {
    handleClick(row) {
      console.log(row);
    },
    page(currentPage){
        //alert(currentPage);
        const _this = this;
    axios.get("http://echo125.link:8001/user/page/"+currentPage+"/5").then(function (resp) {
      console.log(resp.data.result);
      _this.users = resp.data.result.list;
      _this.total = resp.data.result.total;
    })
    }
  },
  data() {
    return {
      total: null,
      users: null
    };
  },
  created() {
    const _this = this;
    axios.get("http://echo125.link:8001/user/page/1/5").then(function (resp) {
      console.log(resp.data.result);
      _this.users = resp.data.result.list;
      _this.total = resp.data.result.total;
    });
  },
};
</script>

<style scoped></style>
